
import os
import logging

LOG_PATH = "./logs/"

def create_syslog():
    logpath = os.path.join(LOG_PATH, "syslog.log")
    syslog = logging.getLogger("syslog")
    syslog.setLevel(level=logging.DEBUG)
    handler = logging.FileHandler(logpath, encoding='utf8')
    handler.setLevel(logging.DEBUG)
    formatter = logging.Formatter('[%(asctime)s][%(levelname)7s][%(threadName)10s][%(funcName)s] - %(message)s')
    handler.setFormatter(formatter)
    syslog.addHandler(handler)


create_syslog()

